﻿using System.Collections.Generic;

namespace Nydus.Model.Interfaces
{
    /// <summary>
    /// Interface for all entity repositories
    /// </summary>
    /// <typeparam name="TEntity">Entity type</typeparam>
    interface IEntityRepository<TEntity>
    {
        /// <summary>
        /// Gets the entity by id.
        /// </summary>
        /// <param name="id">Entity id.</param>
        /// <returns>The entity</returns>
        TEntity GetById(int id);

        /// <summary>
        /// Adds the entity to the repository
        /// </summary>
        /// <param name="entity">The entity.</param>
        void Add(TEntity entity);

        /// <summary>
        /// Deletes the entity from the repository
        /// </summary>
        /// <param name="entity">The entity.</param>
        void Delete(TEntity entity);

        /// <summary>
        /// Get the list of all entities of the currenty
        /// type from the repository.
        /// </summary>
        IList<TEntity> All { get; }
    }
}
